const useDownload: (src: string) => Promise<void> = async (src) => {
    const response = await fetch(src)
    const blob = await response.blob()
    const url = URL.createObjectURL(new Blob([blob]))
    const link = document.createElement('a')
    link.href = url
    link.download = 'image.png'
    document.body.appendChild(link)
    link.click()
    URL.revokeObjectURL(url)
    link.remove()
}

export { useDownload }